﻿<UserControl 
  x:Class="InsuranceAdjuster.MainPage"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" 
  xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"
  xmlns:dataControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit" 
  xmlns:login="clr-namespace:InsuranceAdjuster.LoginUI"
  xmlns:helpers="clr-namespace:InsuranceAdjuster.Helpers"
  xmlns:views="clr-namespace:InsuranceAdjuster.Views"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="600" Background="Red"
    DataContext="{Binding Path=MainPage, Source={StaticResource Locator}}">
    <UserControl.Resources>
        <helpers:VisibilityConverter x:Key="VisibilityConverter" />
        <helpers:NotVisibilityConverter x:Key="NotVisibilityConverter" />
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Style="{StaticResource LayoutRootGridStyle}" Background="{StaticResource GrayBackground}">
        <Grid.RowDefinitions>
            <RowDefinition Height="{StaticResource TitleBarHeight}"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="15"/>
            <ColumnDefinition Width="248"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <Border x:Name="ContentBorder" Style="{StaticResource ContentBorderStyle}" Background="{x:Null}" Margin="0" BorderThickness="0" BorderBrush="{x:Null}" Grid.Column="2" Grid.RowSpan="3">
            <Border BorderThickness="0">
                <navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}" 
    			Source="/Home" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed" BorderThickness="0" HorizontalAlignment="Left" VerticalAlignment="Top">
                    <navigation:Frame.UriMapper>
                        <uriMapper:UriMapper>
                            <uriMapper:UriMapping Uri="" MappedUri="/Views/Home.xaml"/>
                            <uriMapper:UriMapping Uri="/{pageName}/{key}" MappedUri="/Views/{pageName}.xaml?entityGuid={key}"/>
                            <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>
                        </uriMapper:UriMapper>
                    </navigation:Frame.UriMapper>
                </navigation:Frame>
            </Border>
        </Border>
        <Border BorderBrush="Black" BorderThickness="0" Margin="0,0,-3,0" Grid.RowSpan="2">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF56B9FF" Offset="0"/>
                    <GradientStop Color="#FF56B9FF" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
        </Border>
        <Image Margin="15,15,0,0" Source="Assets/SilverlightInsurance_Logo.png" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Top" Height="58" Width="205"/>
        <StackPanel x:Name="LinksStackPanel" Margin="15,0,74,0" Orientation="Vertical" Grid.Row="1" d:LayoutOverrides="Width, Height" Grid.Column="1" VerticalAlignment="Center">
            <HyperlinkButton Content="Appointments" FontSize="21.333" NavigateUri="/Home" TargetName="ContentFrame"  Foreground="#FF807B6E"/>
            <HyperlinkButton Content="Customer" d:LayoutOverrides="Width" FontSize="21.333" Foreground="#FF807B6E" IsEnabled="{Binding EntityManager.IsOnline, Mode=OneWay}"/>
            <HyperlinkButton Content="Agents" d:LayoutOverrides="Width" FontSize="21.333" Foreground="#FF807B6E"/>
            <HyperlinkButton Content="Reports" FontSize="21.333" Foreground="#FF807B6E" IsEnabled="{Binding EntityManager.IsOnline, Mode=OneWay}"/>
            <HyperlinkButton Content="Vehicles" FontSize="21.333" NavigateUri="/VehicleView" TargetName="ContentFrame"  Foreground="#FF807B6E" IsEnabled="{Binding EntityManager.IsOnline, Mode=OneWay}"/>
            <HyperlinkButton Content="News" FontSize="21.333" NavigateUri="/NewsView" TargetName="ContentFrame"  Foreground="#FF807B6E" IsEnabled="{Binding EntityManager.IsOnline, Mode=OneWay}"/>
            <HyperlinkButton Content="Branch Style" FontSize="21.333" Foreground="#FF807B6E" HorizontalAlignment="Left" VerticalAlignment="Bottom" NavigateUri="/BranchView" TargetName="ContentFrame" Visibility="{Binding ShowAdminOnlyFeatures, Converter={StaticResource VisibilityConverter}}" IsEnabled="{Binding EntityManager.IsOnline, Mode=OneWay}" />
            <HyperlinkButton Content="Sync Settings" FontSize="21.333" Foreground="#FF807B6E" HorizontalAlignment="Left" VerticalAlignment="Bottom" NavigateUri="/SyncSettingsView" TargetName="ContentFrame" />
            <!--<HyperlinkButton Content="Sync Status" FontSize="21.333" Foreground="#FF807B6E" HorizontalAlignment="Left" VerticalAlignment="Bottom" NavigateUri="/SyncStatusView" TargetName="ContentFrame" />-->
            <HyperlinkButton Content="Help" FontSize="21.333" Foreground="#FF807B6E" HorizontalAlignment="Left" VerticalAlignment="Bottom" NavigateUri="/HelpView" TargetName="ContentFrame" />
        </StackPanel>

        <Border Grid.Row="2" Grid.ColumnSpan="99" Background="{StaticResource YellowBrush}" BorderBrush="{StaticResource MainTextColor}" BorderThickness="1 1 1 1" Margin="1 0 1 1" Padding="2">
            <views:StatusBarView  Foreground="{StaticResource MainTextColor}">
            </views:StatusBarView>
        </Border>

    </Grid>

</UserControl>